package com.example.gulimall.member.web;

import com.example.common.utils.R;
import com.example.gulimall.member.feign.OrderFeignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.HashMap;
import java.util.Map;

@Controller
public class MemberWebController {

    @Autowired
    OrderFeignService orderFeignService;

    @GetMapping("/memberOrder")
    public String memberOrder(@RequestParam(value = "pageNum",defaultValue = "1") Integer pageNum,
                              Model model){
        // 获取到支付宝传来的请求数据
        // request 要验证签名 防止恶意修改数据导致访问服务结果出错

        Map<String,Object> map = new HashMap<>();
        map.put("page",pageNum.toString());
        R r = orderFeignService.listWithItem(map);
        model.addAttribute("orders",r);
        return "orderList";

    }
}
